package com.example.sofa_module.sofa.details;

import com.example.common.entity.BaseEntity;
import com.example.common.mvvm.model.BaseRespository;
import com.example.sofa_module.sofa.details.entity.DetailsEntity;
import com.example.sofa_module.sofa.entity.InvitationEntity;

import io.reactivex.Observable;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class DetailsModel extends BaseRespository {
    //获取评论列表
    Observable<BaseEntity> requestInvitationList(long itemId){
        Retrofit retrofit=new Retrofit.Builder()
                .client(new OkHttpClient.Builder()
                        .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
                        .build())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .baseUrl("http://118.195.161.134:8088/")
                .build();
        Observable<DetailsEntity> detailsEntityObservable = retrofit.create(ApiService.class).requestDetalis(itemId);
        return checkNetWork(detailsEntityObservable);
    }
}
